package com.coupon.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.common.domain.po.Coupon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * @author 路亚
 * @version 0.1
 * @className CouponMapper
 * @description
 * @date 2024/12/21 15:03
 * @since jdk11
 */
@Mapper
public interface CouponMapper extends BaseMapper<Coupon> {

    @Update("UPDATE coupon SET issue_num = issue_num + 1 WHERE id = #{couponId} AND issue_num < total_num")
    Integer incrIssueNum(Long couponId);
}
